import 'package:flutter/material.dart';

class ShopImg extends StatelessWidget {
  final double imageStyle;
  final String imgUrl;
  ShopImg({Key key, this.imageStyle = 80, @required this.imgUrl})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      width: imageStyle,
      height: imageStyle,
      child: ClipRRect(
        borderRadius: BorderRadius.circular(imageStyle / 8),
        child: FadeInImage.assetNetwork(
          placeholder: 'images/loading.gif', // 占位图
          image: imgUrl,
          fit: BoxFit.cover,
        ),
      ),
    );
  }
}

class ShopDetailImg extends StatelessWidget {
  final BoxFit boxFit;
  final String imgUrl;
  const ShopDetailImg({Key key, this.boxFit, this.imgUrl}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return FadeInImage.assetNetwork(
      placeholder: 'images/loading.gif', // 占位图
      image: imgUrl,
      fit: BoxFit.cover,
    );
  }
}
